/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package VistaConexion;


public class Parametros {
    
   
    private Usuario u;
    
    
    public void deducirMotor(int a, String user, String password){
        
       
        u = new Usuario();

        switch(a){
            case 0:
                u.setDriver("com.mysql.jdbc.Driver");
                u.setUrl("jdbc:mysql://localhost/");
                u.setUser(user);
                u.setPassword(password);

                u.setQuery("show databases;");
                u.setQueryTables("show tables;");
                u.setQueryNameFields("describe ");
                break;
            
            case 1:
                u.setDriver("oracle.jdbc.driver.OracleDriver");
                u.setUrl("jdbc:oracle:thin:@localhost:1521:");
                u.setUser(user);
                u.setPassword(password);

                u.setQuery(u.getUser());
                u.setQueryTables("select TABLE_NAME from ALL_TABLES");
                break;
           
            case 2:
                u.setDriver("org.postgresql.Driver");
                u.setUrl("jdbc:postgresql://localhost:5432/");
                u.setUser(user);
                u.setPassword(password);

                u.setQuery("select * from pg_database");
                u.setQueryTables("SELECT * FROM pg_tables WHERE schemaname = 'public';");
                u.setQueryNameFields("SELECT column_name FROM information_schema.columns " + 
                                     "WHERE table_name = ");
                break;
                
            case 3: 
                u.setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                u.setUrl("jdbc:sqlserver://localhost:1433;");
                u.setUser(user);
                u.setPassword(password);
                u.setQuery("SELECT name FROM master.dbo.sysdatabases WHERE name NOT IN ('master','model','msdb','tempdb')");

                break;
            default:
                break;
        }

    }
    
    
    public Usuario getUsuario() { return u; }
    public void setUusario(Usuario user) { this.u = user; }
}
